import App from './App'
import {
	createSSRApp
} from 'vue'

import log from '@/utils/console'
import storage from '@/utils/storage.js'
import directives from '@/directives'
import uvUI from '@/uni_modules/uv-ui-tools'
import store from '@/store'
import request from './utils/request'
import {
	Toast
} from '@/utils/actions.js'
import {
	repeatClick
} from './utils/tools'
export function createApp() {
	const app = createSSRApp(App)
	app.use(uvUI)
	app.use(store)
	app.config.globalProperties.$log = log
	app.config.globalProperties.$storage = storage
	app.config.globalProperties.$toast = Toast;
	app.config.globalProperties.$repeatClick = repeatClick;
	app.config.globalProperties.$request = request

	// 注册全局指令
	Object.keys(directives).forEach(key => {
		app.directive(key, directives[key])
	})

	return {
		app,
		store
	}
}